package com.itsv.cyzx.adapter;

import java.util.ArrayList;
import java.util.List;

import com.itsv.cyzx.bean.BusinessaddBean;
import com.itsv.cyzx.bean.Me_DetailBean;
import com.itsv.xhyy.R;

import android.content.Context;
import android.graphics.Color;
import android.text.Html;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class BusinessAppAdapter extends BaseAdapter{
	private LayoutInflater inflater = null;
	ArrayList<BusinessaddBean> arrayList;
	private Context con;
	private int intExtra;
	public BusinessAppAdapter(Context con,ArrayList<BusinessaddBean> arrayList, int intExtra) {
		this.con = con;
		this.arrayList = arrayList;
		this.intExtra = intExtra;
		inflater = LayoutInflater.from(con);
	}
	
	public void setlist(ArrayList<BusinessaddBean> arrayList,int intExtra){
		this.arrayList = arrayList;
		this.intExtra = intExtra;
	}
	
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return arrayList.size();
	}

	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return arg0;
	}
	ViewHolder viewHolder = new ViewHolder();
	@Override
	public View getView(int arg0, View convertView, ViewGroup arg2) {
		if (convertView == null) {
			viewHolder = new ViewHolder();
			convertView = inflater.inflate(R.layout.listview_added, null);
			viewHolder.tv_title = (TextView) convertView
					.findViewById(R.id.tv_title);
			viewHolder.tv_date = (TextView) convertView
					.findViewById(R.id.tv_date);
			viewHolder.tv_desc = (TextView) convertView
					.findViewById(R.id.tv_desc);
			convertView.setTag(viewHolder);
		} else {
			viewHolder = (ViewHolder) convertView.getTag();
		}
		if(intExtra == 0){
			viewHolder.tv_title.setText(arrayList.get(arg0).getAppType());
			viewHolder.tv_desc.setText(arrayList.get(arg0).getReason());
			viewHolder.tv_date.setText(arrayList.get(arg0).getAppStatu());
		}else if(intExtra == 1){
			viewHolder.tv_title.setText(arrayList.get(arg0).getPojectName());
			viewHolder.tv_desc.setText(arrayList.get(arg0).getReason());
			viewHolder.tv_date.setText(arrayList.get(arg0).getAppStatu());
		}else if(intExtra == 2){
			viewHolder.tv_title.setText(arrayList.get(arg0).getAppType());
			viewHolder.tv_desc.setText(arrayList.get(arg0).getReason());
			viewHolder.tv_date.setText(arrayList.get(arg0).getAppStatu());
		}
		
		return convertView;
	}
	private static class ViewHolder {
		private TextView tv_desc;
		private TextView tv_date;
		private TextView tv_title;
	}
}
